/*
 * @Author: zhang gen yuan
 * @Date: 2021-09-09 09:43:47
 * @Descripttion: 
 */

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
var VueLoaderPlugin = require('vue-loader/lib/plugin');
const port = 8000;
module.exports = {
    mode: 'development',
    entry: {
        main: './src/main.js',
        private: './src/private.js',
    },
    output: {
        filename: '[name].bundle.js',
        path: path.resolve(__dirname, 'dist'),
        clean: true,
        publicPath: '/',
    },
    devServer: {
        static: './dist',
        open: false,
        port,
    },
    plugins: [
        new HtmlWebpackPlugin({
            title: '管理输出',
        }),
        new VueLoaderPlugin()
    ],
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: 'vue-loader'
            },
            //  加载 css 文件  下载loader
            {
                test: /\.css$/i,
                use: ['style-loader', 'css-loader']
            },
            //  加载 scss 文件  下载loader
            {
                test: /\.scss$/i,
                use: ['style-loader', 'css-loader', 'sass-loader']
            },
            //  加载图片资源
            // {
            //     test: /\.(png|svg|jpg|jpeg|gif)$/i,
            //     type: 'asset/resource',
            // },
            // // 加载fonts字体库
            // {
            //     test: /\.(woff|woff2|eot|ttf|otf)$/i,
            //     type: 'asset/resource',
            // },
            // //类似于 NodeJS，JSON 支持实际上是内置的，也就是说 import Data from './data.json' 默认将正常运行
            // {
            //     test: /\.(csv|tsv)$/i,
            //     use: ['csv-loader'],
            // },
            // {
            //     test: /\.xml$/i,
            //     use: ['xml-loader'],
            // }
        ]
    },
    // resolve: {
    //     alias: {
    //         'vue$': 'vue/dist/vue.esm.js'
    //     }
    // }
}